<template>
  <uni-nav-bar title="身份选择" left-icon="left" @clickLeft="navBack" :fixed="true" statusBar></uni-nav-bar>
  <view class="package space-between" v-for="item in identityList" :key="item.type"
    @click="navTo('administrator/statusIdentity/changeList?type='+item.type)">
    <view class="center">
      <image :src="item.image" mode=""></image>
      <text>{{item.name}}</text>
    </view>
    <uni-icons type="forward" size="25" color="#666"></uni-icons>
  </view>
  <view class="package space-between" v-for="item in list" :key="item.name" @click="navTo(item.push)">
    <view class="center">
      <image :src="item.icon" mode=""></image>
      <text>{{item.name}}</text>
    </view>
    <uni-icons type="forward" size="25" color="#666"></uni-icons>
  </view>
</template>

<script setup lang="ts">
  import { navBack, navTo } from '@/utils/navigator';
  import { ref } from 'vue';
  import { showLoading } from '@/utils/prompt';
  import { toPublish } from '@mqtt';
  import { getShenfen } from '@/gql/administrator';
  const identityList = ref([])
  const list=ref([{name:'我是司机大佬',icon:'https://admin.anlan.tech/uploads/20221227/bd36275184d8e4baa675cdac1884b202.png',push:'index/filling'},
  {name:'推广员',icon:'https://admin.anlan.tech/uploads/20221227/5859a2d9a9c95e47846bc99bc571d140.png',push:'Sale/index/index'}])
  init()
  function init() {
    showLoading()
    const payload = {
      query: getShenfen,
    };
    toPublish(
      'ql/control/getShenfen',
      payload,
      (obj : any) => {
        const { getShenfen } = obj.data;
        identityList.value = getShenfen
      }
    );
  }
</script>

<style scoped lang="less">
  .center {
    image {
      width: 120rpx;
      height: 120rpx;
      border-radius: 5px;
      margin-right: 20rpx;
    }
  }
</style>